package com.ss.s4_Process_Control;

/**
 * @Auther: 520ljs
 * @Date: 2022/3/13 - 03 - 13 - 11:07
 */
public class TestWhile02 {
    //这是一个main方法，是程序的入口
    public static void main(String[] args) {
        /*【1】1+2+3+4+5+。。。。+100*/
        /*int s = 1;
        int sum = 0;
        while (s <= 100) {
            sum += s;
            s++;
        }
        System.out.println(sum);*/

        /*【2】2+4+6+8+。。。。+998+1000*/
        /*int s = 2;
        int sum = 0;
        while(s<=1000){
            sum += s;
            s+=2;
        }
        System.out.println(sum);*/

        /*【3】5+10+15+20+。。。+100*/
        /*int s = 5;
        int sum = 0;
        while(s<=100){
            sum += s;
            s += 5;
        }
        System.out.println(sum);*/

        /*【4】99+97+95+。。5+3+1*/
        /*int s = 99;
        int sum = 0;
        while (s >= 1) {
            sum += s;
            s -= 2;
        }
        System.out.println(sum);*/

        /*【5】1*3*5*7*9*11*13*/
        int s = 1;
        int sum = 1;
        while(s<=13){
            sum *= s;
            s += 2;
        }
        System.out.println(sum);
    }
}
